<template>
<!-- 评论部分 -->
<div class="video-comment">
  <span class="video-comment-title">评论</span>
  <div class="video-comment-sort">
    <span class="video-comment-sort-type"
      v-for="(item, index) in commentSortList" :key="index"
      :class="{ 'sort-type-select': item.value == commentSortType }"
      @click="selectSortType(item.value)">{{item.label}}</span>
  </div>
  <el-divider class="video-comment-line"></el-divider>
  <!-- 发布评论 -->
  <div class="video-comment-self">
    <!-- 左侧是头像 -->
    <div class="video-comment-avatar">
      <el-avatar :src="circleUrl"></el-avatar>
    </div>
    <!-- 中间是文本框 -->
    <el-input type="textarea" :rows="3" resize="none"
      placeholder="注意言辞哦" v-model="yourComment"></el-input>
    <!-- 右侧是发布评论按钮 -->
    <div class="video-comment-post-button">
      发表评论
    </div>
  </div>
  <!-- 所有评论 -->
  <div class="video-comment-list" v-if="haveComment">
    <div class="video-comment-item" v-for="(item, index) in currentCommentDetails" :key="index">
      <!-- 头像 -->
      <a class="user-icon">
        <el-avatar :src="circleUrl"></el-avatar>
      </a>
      <div class="comment-item-components">
        <!-- 名称 -->
        <span class="comment-nickname">{{item.comment_username}}</span>
        <!-- 评论正文 -->
        <p class="comment-content">{{item.comment_comment}}</p>
        <!-- 点赞/踩 信息 -->
        <div class="comment-info">
          <!-- 喜欢 -->
          <div class="like">
          <i class="iconfont icon-good"></i>
          <span>{{item.good_count}}</span>
          </div>
          <!-- 不喜欢 -->
          <div class="dislike">
          <i class="iconfont icon-bad"></i>
          <span>{{item.bad_count}}</span>
          </div>
        </div>
        <!-- 回复 -->
        <div class="comment-reply" v-if="item.reply != null">
          <div class="reply-item" v-for="(reply, reply_index) in item.reply" :key="reply_index">
            <!-- 头像 -->
            <a class="reply-icon">
              <el-avatar :src="circleUrl"></el-avatar>
            </a>
            <div class="reply-container">
              <div class="reply-user">
                <!-- id -->
                <span class="reply-nickname">{{reply.reply_username}}</span>
                <!-- 回复内容 -->
                <span class="reply-content">{{reply.reply_comment}}</span>
              </div>
              <!-- 点赞/踩 信息 -->
              <div class="reply-info">
                <div class="like">
                <i class="iconfont icon-good"></i>
                <span>{{reply.good_count}}</span>
                </div>
                <div class="dislike">
                <i class="iconfont icon-bad"></i>
                <span>{{reply.bad_count}}</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</template>
<script></script>
<style scoped>
/* 评论部分 */
.video-comment-title {
  display: block;
  /* padding: 0 0 20px 0; */
  font-size: 20px;
  height: 50px;
  line-height: 50px;
}
/* 评论默认样式 */
.video-comment-sort-type {
  display: inline-block;
  height: 30px;
  line-height: 30px;
  font-weight: 600;
  cursor: pointer;
}
.video-comment-sort-type:first-child {
  margin-right: 32px;
}
.video-comment-sort-heat {
  margin-right: 32px;
}
/* 选中样式 */
.sort-type-select {
  color: #269cc8;
  border-bottom: 1px solid #269cc8;
}
/* 分隔符样式 */
.video-comment-line {
  margin-top: 0;
}
/* 个人评论部分 */
.video-comment-self {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 30px;
  width: 100%;
}
.video-comment-avatar {
  width: 48px;
  height: 48px;
}
.el-avatar {
  width: 100%;
  height: 100%;
}
/* 评论框 */
.el-textarea {
  width: calc(100% - 172px);
}
.el-textarea:hover>>>.el-textarea__inner {
  border: 1px solid #269cc8;
}
.video-comment-post-button {
  cursor: pointer;
  background: #269cc8;
  color: #fff;
  padding: 19px 20px;
  border-radius: 4px;
  width: 40px;
  text-align: center;
  font-size: 15px;
}
.video-comment-post-button:hover {
  background: #36abd8;
}

.user-icon {
  float: left;
  margin: 24px 0 0 5px;
  position: relative;
  width: 48px;
  height: 48px;
}
.comment-item-components {
  position: relative;
  margin-left: 75px;
  padding: 22px 0 14px;
  border-top: 1px solid #e5e9ef;
}
.comment-nickname {
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  padding-bottom: 4px;
  display: block;
  word-wrap: break-word;
  position: relative;
}
.comment-content {
  text-indent: 0;
  line-height: 20px;
  padding: 2px 0;
  font-size: 14px;
  text-shadow: none;
  overflow: hidden;
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
}
.comment-info {
  color: #99a2aa;
  line-height: 26px;
  font-size: 12px;
}
.comment-info div {
  cursor: pointer;
}
.like {
  display: inline-block;
  margin: 5px 20px;
}
.dislike {
  display: inline-block;
}
.comment-reply {
  box-sizing: content-box;
}
/* 回复部分 */
.reply-item {
  padding: 10px 0;
}
.reply-icon {
  display: inline-block;
  position: relative;
  margin-right: 10px;
  vertical-align: top;
  width: 30px;
  height: 30px;
}
.reply-container {
  display: inline-block;
  width: calc(100% - 40px);
}
.reply-user {
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  padding-bottom: 4px;
  display: block;
  word-wrap: break-word;
  position: relative;
}
.reply-nickname {
  position: relative;
  top: -1px;
}
.reply-content {
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  white-space: pre-wrap;
}
.reply-info {
  color: #99a2aa;
  line-height: 26px;
  font-size: 12px;
}
.reply-info div {
  cursor: pointer;
}
</style>